﻿using BaseData.API.Read.Applications.DoctorScheduling.Command;
using BaseData.API.Read.Applications.DoctorScheduling.CommandHandler;
using BaseData.API.Read.Dtos.DoctorSchedulingDto;
using BaseData.Domain.HospitalInformation;
using BaseData.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BaseData.API.Read.Controllers.DoctorScheduling
{
    /// <summary>
    /// 医生排班控制器-读
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class DoctorSchedulingController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;

        public DoctorSchedulingController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 查询医生排班列表
        /// </summary>
        /// <param name="command">查询参数</param>
        /// <returns>返回任务</returns>
        [HttpGet("ShowDoctorScheduling")]
        public Task<ApiResult<ApiPaging<DoctorSchedulingDto>>> ShowDoctorScheduling([FromQuery]DoctorSchedulingCommand command)
        {
            try
            {
                return mediator.Send(command);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 查询医生排班一条数据
        /// </summary>
        /// <param name="command">查询参数</param>
        /// <returns>返回任务</returns>
        [HttpGet("GetDoctorScheduling")]
        public Task<ApiResult<DoctorSchedulingDto>> GetDoctorScheduling([FromQuery]GetDoctorSchedulingCommand command)
        {
            try
            {
                return mediator.Send(command);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 查询医生列表
        /// </summary>
        /// <returns>返回任务</returns>
        [HttpGet("GetDoctor")]
        public Task<ApiResult<List<Doctors>>> GetDoctor()
        {
            try
            {
                GetDoctorComamnd command=new GetDoctorComamnd();
                return mediator.Send(command);

            }
            catch (Exception)
            {

                throw;
            }

        }
    }
}
